package com.cskaoyan.javase.oop1._10block._4classload;

/**
 * @description: 类加载初始化过程是完成静态代码块的调用
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

public class Demo {
    static Cat cat = new Cat(); //static int a = 10; 静态成员变量的显式赋值
    static {
        System.out.println("Demo 静态代码块执行");
    }
    Dog dog = new Dog();
    Dog dog2;

    public static void main(String[] args) {
       //System.out.println("hello world!");
        //Demo d = new Demo();
    }

    public Demo() {
        System.out.println("demo");
    }
}

class Cat {
    static {
        System.out.println("Cat 静态代码块执行");
    }
    static Dog dog = new Dog(); //static3 int a = 10;

    public Cat() {
        System.out.println("cat");
    }
}

class Dog {
    static {
        System.out.println("Dog 静态代码块执行");
    }
    static Demo demo = new Demo();
    public Dog() {
        System.out.println("dog");
    }
}